package com.veo.controller;

import com.veo.entity.Department;
import com.veo.mapper.DepartmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DepartmentController {

    @Autowired
    private DepartmentMapper mapper;

    @GetMapping("/dept/{id}")
    public Department getDepartment(@PathVariable("id")Integer id){
        return mapper.getDeptById(id);
    }

    @GetMapping("/dept")
    public Department insertDepartment(Department department){
        mapper.insertDept(department);
        return department;
    }
}
